package theone.ui;

import org.newdawn.slick.Color;
import org.newdawn.slick.Font;
import org.newdawn.slick.Graphics;

/**
 * 
 * @author Damien
 *
 */
public class UiLabel extends UiComponent {
	
	private String m_text;
	private Font m_font;
	
	public UiLabel(Font font, String text) {
		m_font = font;
		m_text = text;
	}
	
	
	public void draw(Graphics g, int offsetX, int offsetY) {
		
		Color currentColor = Faded;
		if (isHover())
		{
			currentColor = Bright;
		}
		
		
		// Draw text
		g.setFont(m_font);
		g.setColor(currentColor);
		g.drawString(m_text, offsetX + getX() + ((getWidth() - m_font.getWidth(m_text))/2), 
				offsetY + getY() + ((getHeight() - m_font.getHeight(m_text))/2));
		
	}
	
	public void setText(String text)
	{
		m_text = text;
	}
}
